﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ZhimeiSoft.Framework.Client.Utils
{
    public class MsgBox
    {
        /// <summary>
        /// 提示信息对话框
        /// </summary>
        /// <param name="msg">提示内容</param>
        public static void MsgInfo(string msg)
        {
            MessageBox.Show(msg, "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }

        public static bool MsgQue(string msg)
        {
            return MessageBox.Show(msg, "提示信息", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes;
        }

        public static bool MsgWarQue(string msg)
        {
            return MessageBox.Show(msg, "提示信息", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes;
        }

        public static bool MsgOkCacel(string msg)
        {
            return MessageBox.Show(msg, "提示信息", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK;
        }

        /// <summary>
        /// 是否关闭窗体对话框
        /// </summary>
        /// <param name="msg">提示内容</param>
        /// <returns>1：关闭，-1：不关闭，0：取消</returns>
        public static int MsgCloseForm(string msg)
        {
            DialogResult result = MessageBox.Show(msg, "提示信息", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
            if (result == DialogResult.Yes)
            {
                return 1;
            }
            else if (result == DialogResult.No)
            {
                return -1;
            }
            else
            {
                return 0;
            }
        }

        /// <summary>
        /// 错误信息对话框
        /// </summary>
        /// <param name="msg">错误信息内容</param>
        public static void MsgErr(string msg)
        {
            MessageBox.Show(msg, "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
    }
}
